package blocks
{
	
	import blocks.DynamicBlock;
	
	import org.flixel.FlxG;
	import org.flixel.plugin.photonstorm.FlxMath;
	
	public class Collect extends DynamicBlock
	{
		
		private var description:String;
		private var url:String;
		private var bonusType:String;
		
		public function Collect(X:int, Y:int, infos:Object, mapName:String) {
			super(X,Y,infos, mapName);
			
			description = infos.description ;
			url = infos.url;
			bonusType = infos.bonusType;
			
		}
		
		public function collecting():void{
			super.kill();
			
			switch(bonusType){
				case 'health':
					var percent:Number = Registry.player.infos.gamePlay.health * 25 / 100;
					Registry.player.health += percent;
					if(Registry.player.health > 100 ) Registry.player.health = 100 ;
					break;
				case 'life':
					Registry.player.infos.gamePlay.lives++;
					break;
			}
		}
	}
}